# $Id: PKGBUILD 76643 2012-09-25 15:23:38Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
#$Id: PKGBUILD 76643 2012-09-25 15:23:38Z spupykin $
# Maintainer: JJDaNiMoTh <jjdanimoth.aur@gmail.com>
# Contributor: zlowly <zlowly [at] archlinux.org>

pkgname=wqy-zenhei
pkgver=0.9.45
pkgrel=3
pkgdesc="A Hei Ti Style (sans-serif) Chinese Outline Font."
arch=('any')
license=('GPL2' 'custom:"font embedding exception"')
install=wqy-zenhei.install
url="http://wenq.org/enindex.cgi"
depends=('fontconfig' 'xorg-font-utils')
source=("http://downloads.sourceforge.net/project/wqy/wqy-zenhei/$pkgver%20%28Fighting-state%20RC1%29/wqy-zenhei-$pkgver.tar.gz"
	"44-wqy-zenhei.conf.diff")
md5sums=('4c6c3f4e902dd5ee0a121e8c41d040bd'
         '1cdbb5dd5ea90faf48cf1ba61077da15')

build() {
  cd $srcdir/$pkgname

  patch -p0 44-wqy-zenhei.conf <$srcdir/44-wqy-zenhei.conf.diff

  grep README -e "GPL v2 license with font embedding exception" -A 12 >| FONTEXCEPTION

  mkdir -p $pkgdir/usr/share/fonts/wenquanyi/wqy-zenhei/
  mkdir -p $pkgdir/etc/fonts/conf.avail/
  mkdir -p $pkgdir/etc/fonts/conf.d

  install -m644 -D FONTEXCEPTION $pkgdir/usr/share/licenses/${pkgname}/FONTEXCEPTION
  install -m644 *.ttc $pkgdir/usr/share/fonts/wenquanyi/wqy-zenhei/
  install -m644 *.conf $pkgdir/etc/fonts/conf.avail/
  install -m755 -D zenheiset $pkgdir/usr/bin/zenheiset

  # https://bugs.archlinux.org/task/24177
  mv $pkgdir/etc/fonts/conf.avail/44-wqy-zenhei.conf $pkgdir/etc/fonts/conf.avail/65-wqy-zenhei.conf

  cd $pkgdir/etc/fonts/conf.d/
  ln -s ../conf.avail/65-wqy-zenhei.conf .
#  ln -s ../conf.avail/66-wqy-zenhei-sharp.conf .
}
